/*
 * @Author: 马思宁 598138645@qq.com
 * @Date: 2024-05-07 15:57:32
 * @LastEditors: 马思宁 598138645@qq.com
 * @LastEditTime: 2024-05-10 10:14:33
 * @FilePath: \v-manage\src\api\login.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request';

/**
 * 登录方法
 *
 * @param {object} loginParam 登录参数
 * @returns
 */
export const login = async (loginParam: any) => {
  return await request({
    url: '/login',
    method: 'post',
    data: loginParam,
  });
};

/**
 * 获取用户(角色与权限)详细信息
 *
 * @returns
 */
export const getInfo = async () => {
  return await request({
    url: '/getInfo',
    method: 'get',
  });
};

/**
 * 退出
 *
 * @returns
 */
export const logout = async () => {
  return await request({
    url: '/logout',
    method: 'post',
  });
};

/**
 * 获取验证码
 *
 * @returns
 */
export const getCodeImg = async () => {
  return await request({
    url: '/captchaImage',
    headers: {
      isToken: false,
    },
    method: 'get',
    timeout: 20000,
  });
};

// 注册方法
export const register = async (data: any) => {
  return await request({
    url: '/register',
    headers: {
      isToken: false,
    },
    method: 'post',
    data: data,
  });
};
